package cn.regexp.service.impl;

import cn.regexp.domain.ShopBanner;
import cn.regexp.mapper.BannerMapper;
import cn.regexp.service.IBannerService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BannerServiceImpl extends ServiceImpl<BannerMapper, ShopBanner> implements IBannerService {

    @Override
    public List<ShopBanner> queryBanner() {
        QueryWrapper<ShopBanner> wrapper = new QueryWrapper<>();
        wrapper.eq("state", ShopBanner.STATE_NORMAL)    // 查询展示的 banner
                .orderByDesc("sort");   // 进行降序排序
        return super.list(wrapper);
    }
}
